#pragma once
#include <windows.h>
#include <string>
#include <vector>

namespace umtl
{
	class bmp
	{
	public:
		typedef std::vector<char> Buffer;

		bmp();

		bool load( char const * filename );

		bool save( char const * filename );


		inline char *					data()			{ return buffer_.empty() ? 0 : &buffer_[0]; }

		inline size_t					size() const	{ return buffer_.size(); }

		inline std::string const &		name() const	{ return filename_; }

		bool							set( char const * data, size_t w, size_t h );

		inline size_t					width() const	{ return infoHeader_.biWidth; }

		inline size_t					height() const	{ return infoHeader_.biHeight; }

	private:
		BITMAPFILEHEADER fileHeader_;
		BITMAPINFOHEADER infoHeader_;
		std::string filename_;
		Buffer buffer_;
		int offset_;

		bmp( bmp const & other );
		void operator=(bmp const & other);
	};
}